//
//  PersonCityChoose.m
//  timelyRain
//
//  Created by Jiafei Wei on 2017/1/3.
//  Copyright © 2017年 Jiafei Wei. All rights reserved.
//

#import "PersonCityChoose.h"
#import "PSCityPickerView.h"
@interface PersonCityChoose ()<PSCityPickerViewDelegate>
@property (weak, nonatomic) IBOutlet UITextField *city;
@property (nonatomic, strong) PSCityPickerView *cityPicker;
@end

@implementation PersonCityChoose

- (void)viewDidLoad {
    [super viewDidLoad];
    [super setTitleView:self.view withName:@"城市选择"];
   _city.inputView = self.cityPicker;
    _city.text=_cityValue;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (PSCityPickerView *)cityPicker
{
    if (!_cityPicker)
    {
        _cityPicker = [[PSCityPickerView alloc] init];
        _cityPicker.cityPickerDelegate = self;
    }
    return _cityPicker;
}
- (void)cityPickerView:(PSCityPickerView *)picker
    finishPickProvince:(NSString *)province
                  city:(NSString *)city
              district:(NSString *)district
{
    NSString *cityname =[NSString stringWithFormat:@"%@ %@ %@",province,city,district];
    [_city setText:cityname];
    NSNotification * notice = [NSNotification notificationWithName:@"setting_data" object:nil userInfo:@{@"type":@"city",@"data":cityname}];
    [[NSNotificationCenter defaultCenter]postNotification:notice];
}
@end
